import { Label, ProgressBar, _decorator } from 'cc';
import { BaseFightBoxComp } from './BaseFightBoxComp';
import IBaseHurt from './core/data/IBaseHurt';
import IBaseInjureBullet from './core/fight/IBaseInjureBullet';
const { ccclass, property } = _decorator;

@ccclass('BuildBaseFightComp')
export class BuildBaseFightComp extends BaseFightBoxComp {
    /****************************************************************************************************************
     *Readonly 常量
     ****************************************************************************************************************/
    /****************************************************************************************************************
     *Property 定义变量
     ****************************************************************************************************************/
    /***************************************************************
     *PropertyUI 引用的控件
     ***************************************************************/
    @property({ group: { name: 'View', id: '3' }, type: ProgressBar, tooltip: `更新血量` })
    protected hpProgress: ProgressBar = null;

    @property({ group: { name: 'View', id: '3' }, type: Label, tooltip: `血量文本组件` })
    private hpLabel: Label = undefined!;
    /****************************************************************************************************************
     * Lifecycle 生命周期相关方法
     ****************************************************************************************************************/
    /****************************************************************************************************************
     * Public 公有方法
     ****************************************************************************************************************/
    /****************************************************************************************************************
     * private 私有方法
     ****************************************************************************************************************/
    public hurt(bullet: IBaseInjureBullet): IBaseHurt {
        let hurt = super.hurt(bullet);
        console.log(`建筑受到伤害`);
        console.log(hurt)
        return hurt;
    }

    protected override updateHp(hp: number): void {
        super.updateHp(hp);


        if (this.hpLabel) {
            this.hpLabel.string = `${hp}/${this.maxHp}`;
        }
    }
    /****************************************************************************************************************
     * Property Get && Set 属性的 get && set 函数
     ****************************************************************************************************************/

}


